import axios from 'axios';
const state = {
    circleRole: '',
    circleId: 0
};

export default {
    state,
    getters: {
        getCircleRole: state => {
            return state.circleRole;
        },
        getCircleId: state => {
            return state.circleId;
        }
    },
    mutations: {
        setCircleRole(state, payload) {
            state.circleRole = payload;
        },
        setCircleId(state, payload) {
            state.circleId = payload;
        }
    },
    actions: {
        /**
     * 报名在学一次
     * @param state
     * @param id 课程id 判断当前时候有课程id 没有就使用手动传入的id
     * @returns {Promise<any>}
     */
        contentTipBtnAction({state}, id) {
            let itmId = state.detail.item.itm_id ? state.detail.item.itm_id : id;
            return new Promise((resolve, reject) => {
                axios({
                    method: 'GET',
                    url: `/app/application/app?itm_id=${itmId}`
                }).then(res => {
                    resolve();
                });
            });
        }
    }
};
